#include "widget.h"
#include "book.h"
#include "./ui_widget.h"
#include <QMessageBox>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    //登录按钮槽函数
    connect(ui->loginbtn,&QPushButton::clicked,this,&Widget::Login);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::Login()
{
    ui->useredit->setText("xxx");
    ui->pwdedit->setText("xxx");
    if(ui->useredit->text()=="xxx"&&ui->pwdedit->text()=="xxx"){
        userflag=true;
        pwdflag=true;
    }else{
        QMessageBox::information(this,"登录","登录失败");
        return;
    }

    if(userflag&&pwdflag){
        //同时为真,才能登录
        QMessageBox::information(this,"登录","登录成功！");
        Book *newbook=new Book(this);
        this->close();
        newbook->show();
    }

}
